home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp95
/
turboc.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
13KB
|
271 lines
Mark G. Forbes, Sparcom Corp. (forbesm@jacobs.cs.orst.edu)
work 503-757-8416 (where I spend all my time) (or, support@sparcom.com)
home 754-3104 (where the hedges grow ever larger)
Disclaimer: "WE are the people our parents warned us about!"
Path: irisa!corton!mcsun!news.funet.fi!sunic!psinntp!psinntp!uunet!ogicse!hp-cv!hp-pcd!hpcvra.cv.hp.com!andyg
From: andyg@hpcvra.cv.hp.com. (Andrew Gryc)
Newsgroups: comp.sys.palmtops
Subject: Using Turbo C to create HP95LX EXM files
Message-ID: <65300031@hpcvra.cv.hp.com.>
Date: 9 Oct 91 19:58:56 GMT
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 110
***********************************************************************
Using Borland C to create .EXM files for the HP95LX
***********************************************************************
Yes, believe it or not, you can use Borland tools to create System
Manager compliant applications for the 95LX! Although this has been
tested only with Turbo C++ and Borland C++, it should work for the whole
Turbo C family. The two basic problems to work around are the startup
code and the E2M program.
(NOTE: TKERNEL is a PC TSR that provides the SysMgr services on the PC,
in a non-task-swapping environment, allowing you to debug your program
on a PC, using standard PC debuggers. Unfortunately, this program is
property of Lotus Corporation, which as decided NOT to allow its
distribution to anyone EXCEPT for ISV's that have been accepted into
the supported ISV program. However, the rest of this note (regarding
creating .EXM files for use on the HP 95LX, is applicable even if you
DON'T have access to TKERNEL.)
To create programs to run under TKERNEL, you shouldn't need to do
anything special. Just make sure to link in CSVC.OBJ (included in the
ISV kit and on the HP BBS) so the c_service routines are defined. Since
you will probably want to use the Turbo C integrated environment, MAKE
SURE YOU INCLUDE any #defines that the Microsoft make file may jam in
before you compile. BOXES.C is an example of this: it defines TKERNEL
from the make file for the tkernel file, but does not for the EXM file.
If you run non-TKERNEL code under TKERNEL you will almost certainly have
problems (eg. Divide overflow) since TKERNEL doesn't support the full
set of System Manager functions.
STEP 1
------
To create .EXM programs for the System Manager, it gets a little more
complicated. First of all, you need to trick Turbo C into leaving out
its own startup code and including CRT0.OBJ (also included in the ISV
kit / HP BBS). CRT0 is just about the minimum that is needed upon
startup so the program doesn't do all kinds of funny stuff on the 95
that isn't supported. To do this, go to the directory that you keep
your CRT0.OBJ and CSVC.OBJ files (assume it is \HP95\TOOLS) , and copy
CRT0.OBJ into a new file, C0S.OBJ. C0S.OBJ is the file that Turbo C
uses for small model startup code, so we're just replacing it.
Now go into the integrated environment under Options/Directory/Libraries,
and insert the directory name \HP95\TOOLS; (or whatever you use) *in
front* of what currently lies there (so it will find our "fake" C0S
first). Also remember to link in CSVC.OBJ as well (just add it to your
project file). Now you should be able to compile your SysMgr app with no
problems. (Other helpful hints on compiling: Remember under small model
code only, no floating point code, and don't link in the graphics
library.)
STEP 2
------
Step 1 will get you a .EXE, but you still need to run E2M to
produce the .EXM file that will end up in the 95LX. The E2M program
relies on the .MAP file to deduce the data/code segment dividing point.
If you don't already have it set, go into Options/Linker/Mapfile, and
set it to Segments (if you have more map info in the file, that's okay,
but Segments is needed at least).
Unfortunately for us, the output of Turbo Map files is not exactly
compatible with the Microsoft format, so either you need to 1) Use the
old E2M and massage the format to what is needed, or 2) write a small
program that will do the massaging for you.
Here's how to do it manually: load the .MAP file into the text editor
of your choice. Right below the Segment list, you need to insert a couple of
lines of text that will give the DGROUP orgin (ie. beginning of all the data).
The text must be exact--even spaces count. Type in this:
Orgin Group
xxxx:0 DGROUP
where xxxx is the first four digits in the Start column of the Segment
titled _DATA. As an example, this is the .MAP file produces for BOXES,
after we have modified it.
----------------------------
Start Stop Length Name Class
00000H 01D70H 01D71H _TEXT CODE
01D80H 024D1H 00752H _DATA DATA
024E0H 02CDFH 00800H STACK STACK
02CE0H 033E9H 0070AH _BSS BSS
Origin Group
01D8:0 DGROUP
----------------------------
We looked up the segment named _DATA, and took the 01D8 (segment value)
to put in this new information. With this small modification to the .MAP
file, the E2M program will convert your Turbo C .EXE without a snag.
In theory, it shouldn't be too hard to whip up a program that adds this
little bit of tag information to your map file, and just remember to run
this before you run E2M. Since the rest of the file beyond the "Origin"
stuff isn't used by E2M, and since the segment info is not likely to change
for a SysMgr app, you could cheat. Your massager program could seek to
the right position in the .MAP file to read out the segment (01D8), and
seek past it to write this new little block (although it wouldn't be
that much more work to read through the file and do a little parsing to
find the _DATA line).
I would strongly suggest trying this out on a program that you know runs
properly under the System Manager first before you start trying untested
programs under TKERNEL or the 95LX.
For those of us who would much rather use Borland tools (present company
included), this fix ought to make System Manager programming a little more
palatable.
--Andy Gryc
Path: irisa!corton!mcsun!news.funet.fi!sunic!psinntp!psinntp!uunet!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!gatech!ncar!csn!copper!aspen.craycos.com!ewv
From: ewv@craycos.com (Eric Varsanyi)
Newsgroups: comp.sys.palmtops
Subject: Re: Using Turbo C to create HP95LX EXM files
Message-ID: <1991Oct10.202707.16443@craycos.com>
Date: 10 Oct 91 20:27:07 GMT
References: <65300031@hpcvra.cv.hp.com.>
Organization: Cray Computer Corporation
Lines: 40
In article <65300031@hpcvra.cv.hp.com.> andyg@hpcvra.cv.hp.com. (Andrew Gryc) writes:
>Yes, believe it or not, you can use Borland tools to create System
>Manager compliant applications for the 95LX! Although this has been
>tested only with Turbo C++ and Borland C++, it should work for the whole
>Turbo C family. The two basic problems to work around are the startup
>code and the E2M program.
Yes, you can use regular turbo C to create stuff for the HP95LX, there
is a trick not mentioned by the author however... The Borland libraries use
some externals that Borland stuck int c0s.asm. If you link and get
errors with unresolved refs that have 'Vector' in them, it is safe
defining 'long' variables somewhere to satisfy these references.
>(NOTE: TKERNEL is a PC TSR that provides the SysMgr services on the PC,
> in a non-task-swapping environment, allowing you to debug your program
> on a PC, using standard PC debuggers.
Has anyone ever gotten TKERNEL to work with a monochrome adapter? It
works OK for me (I can type at it and it seems to be doing stuff) but
the display is always blank. Is it writing to the CGA memory?
>To create .EXM programs for the System Manager, it gets a little more
>complicated. First of all, you need to trick Turbo C into leaving out
>its own startup code and including CRT0.OBJ (also included in the ISV
>kit / HP BBS).
This isn't much of a trick if you just use regular makefiles and the
command line version of tcc and tlink/link.
>Unfortunately for us, the output of Turbo Map files is not exactly
>compatible with the Microsoft format, so either you need to 1) Use the
>old E2M and massage the format to what is needed, or 2) write a small
>program that will do the massaging for you.
E2M does very little to the .EXE file (only seems to change a couple
of words). If someone can describe what it does I would be happy to
write and post a version that will eat TLINK map files. I have this
same problem and just use the Microsoft linker instead.
-Eric Varsanyi Cray Computer Corporation ewv@craycos.com
Path: irisa!corton!mcsun!uunet!cs.utexas.edu!wupost!sdd.hp.com!hplabs!hpfcso!hpfcbig!lisa
From: lisa@hpfcbig.SDE.HP.COM (Lisa Stroyan)
Newsgroups: comp.sys.palmtops
Subject: lowest 95lx price and new software
Message-ID: <41730019@hpfcbig.SDE.HP.COM>
Date: 10 Oct 91 14:44:07 GMT
Organization: HP SESD, Fort Collins, CO
Lines: 24
I saw the lowest price I have seen so far for a 95lx yesterday. 489.99,
at a new store that just opened in Fort Collins, CO, called "Office
Depot Inc". This company is a result of a merger between the Florida
based (?) Office Depot and the LA, CA based Office Club, so there may
be one in your area.
They also have 95lx accessories, but unfortunately, the discount on
them is much less ($89 for the connectivity pack and *lots* for the
RAM card, I don't remember how much).
On another thought, I got an ad for 95lx software in the mail the
other day -- I was so excited to see that companies are finally
starting to sell software! It was some money management program that
would run both on a PC (full size) and run under the system manager on
the 95lx, so that you could use it either place. (sorry, I didn't
bring the ad in today, so I don't know the name). Has anyone tried
this program? If so, what do you think? I would love a program like
that for the 95, but I use a different one, Phasar, on an Amiga. I
would only be willing to switch to using something on my PCs if the
program was really well done, because I like Phasar a lot.
Thanks,
Lisa
Path: irisa!corton!mcsun!unido!fauern!ira.uka.de!yale.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!hpfcdc!jsm
From: jsm@hpfcdc.HP.COM (John Marvin)
Newsgroups: comp.sys.palmtops
Subject: Re: Using Turbo C to create HP95LX EXM files
Message-ID: <50840009@hpfcdc.HP.COM>
Date: 12 Oct 91 08:24:23 GMT
References: <65300031@hpcvra.cv.hp.com.>
Organization: HP Fort Collins, Co.
Lines: 53
I also use Turbo C to create System Manager compliant programs. Since
I have not bought the assembler, I link in the following C module (I call
it tcdummy.c).:
unsigned long __brklvl;
unsigned long errno;
unsigned long _envLng;
unsigned long _envseg;
unsigned long _envSize;
unsigned long abort;
unsigned char *_C0environ[] = { (unsigned char *)0 };
I add declarations as I come across other variables that the Turbo C
C-library uses. It would be nice if someone would write a System Manager
version of crt0.s for Turbo C. If someone does write a new crt0.s, might
I suggest that it include the code from csvc.obj? I don't see any reason
for two different .obj files, since the special crt0.obj would only be
used for System Manager compliant applications.
As far as the .MAP file is concerned, be aware that you may also have
an initialized data segment preceding the data segment. Here is an
example from one of my programs:
Start Stop Length Name Class
00000H 0240FH 02410H _TEXT CODE
02410H 02415H 00006H _INIT_ INITDATA
02418H 02997H 00580H _DATA DATA
02998H 02C03H 0026CH _BSS BSS
02C08H 03407H 00800H STACK STACK
Program entry point at 0000:0000
A person writing a new E2M program should look for both _INIT_ and _DATA.
Eric Varsanyi volunteered to write a new E2M if someone would tell him
what E2M does. Please note that I do not work at Corvallis and have
only figured this out by doing the same comparison anyone else could do.
E2M changes only two 16 bit words in the .EXE file. At offset 0x00 it
changes the EXE magic number from 0x5A4D to 0x4C44. It then puts the
Data segment paragraph address (0x0241 in the above example) at offset
0x1A (This offset is normally used for the overlay number for a .EXE file).
I think that a new E2M doesn't even need to copy the EXE file. It could
modify the file in place and then just rename the file (it might be nice
to have an option that does this, instead of copying the file).
John Marvin
jsm@patchnos.fc.hp.com
DISCLAIMER: Although I work for HP, I do not work with the folks in
Corvallis, and I certainly do not speak for HP.